import request from '@/utils/request'
import { GEN_SERVER } from '@/config/baseUrl'

// 查询ERP班组信息列表
export function listErpGroup(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/erpGroup/list',
    method: 'post',
    data: data
  })
}

// 根据班组，查询不可用人员列表
export function getUnSelectableUserByGroupId(groupId) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/erpGroup/getUnSelectableUsernamesByGroupId',
    method: 'get',
    params: {
      groupId
    }
  })
}

// 查询ERP班组信息详细
export function getErpGroup(id) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/erpGroup/detail',
    method: 'get',
    params: {
        id
    }
  })
}

// 新增/修改ERP班组信息
export function addOrUpdateErpGroup(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/erpGroup/addOrUpdate',
    method: 'post',
    data: data
  })
}

// 删除ERP班组信息
export function delErpGroup(id) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/erpGroup/deleteByIds',
    method: 'post',
    params: {
      ids: id
    }
  })
}

// 导出ERP班组信息
export function exportErpGroup(query) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/erpGroup/export',
    method: 'post',
    data: query
  })
}

export function getErpGroupsByLineId(lineId) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/erpGroup/getErpGroupsByLineId',
    method: 'get',
    params: { lineId }
  })
}